home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2005-10-28 | 61.4 KB | 1,975 lines
class mx.data.components.DataSet extends MovieClip { var _loading; var _eventDispatcher; var super_addBinding; var _fldValObj; var __schema; var __toProperties; var _calcFields; var _enableEvents; var _event; var _itemClass; var _hasDelta; var _deltaPacket; var _filterFunc; var _filtered; var _srcSchema; var _defValues; var __logChanges; var __readOnly; var __itemClassName; var _trapProperties; var __curItem; var _dpIndexByTransId; var _iterator; var getField; var __items; var __schemaXML; var _invalidSchema; var _iterators; var _itemIndexById; var _dpTransIdCount; var _lastTransId; var _optDeltaItems; var _deltaItems; var _propCage; static var DefaultIterator = "__default__"; static var ItemId = "__ID__"; var _allowReslv = false; function DataSet() { super(); this._loading = false; this._eventDispatcher = new Object(); mx.events.EventDispatcher.initialize(this._eventDispatcher); this.super_addBinding = mx.data.binding.ComponentMixins.prototype.addBinding; this._fldValObj = new Object(); this._fldValObj.__schema = this.__schema; mx.data.binding.ComponentMixins.initComponent(this._fldValObj); mx.data.binding.ComponentMixins.initComponent(this); this.__toProperties = new Object(); this._calcFields = new Object(); this._calcFields.__length__ = 0; this.initCollection(); this.initIterators(); this._enableEvents = 0; this._event = null; this._itemClass = null; this._hasDelta = 0; this._deltaPacket = null; this._filterFunc = null; this._visible = false; this._filtered = false; this._srcSchema = null; this._defValues = new Object(); this._name = this._name != undefined ? this._name : ""; this.__logChanges = this.__logChanges != undefined ? this.__logChanges : true; this.__readOnly = this.__readOnly != undefined ? this.__readOnly : false; this.__itemClassName = this.__itemClassName != undefined ? this.__itemClassName : ""; this._trapProperties = false; this.buildSchema(); this.createProperties(); } function get currentItem() { return this.__curItem; } function get deltaPacket() { return this._deltaPacket; } function set deltaPacket(dp) { if(dp != null) { var _loc9_ = dp.getIterator(); var _loc5_ = undefined; var _loc13_ = new Array(); var _loc12_ = this._dpIndexByTransId[dp.getTransactionId()]; if(_loc12_ != undefined) { this.internalClearDeltaPacket(dp.getTransactionId()); while(_loc9_.hasNext()) { _loc5_ = mx.data.components.datasetclasses.Delta(_loc9_.next()); if(_loc12_.items[_loc5_.getId()] == null) { throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t resolve item with ID [" + _loc5_.getId() + "] specified in deltaPacket [" + dp.getTransactionId() + "]. Error for DataSet \'" + this._name + "\'."); } this.applyResolvePacket(_loc5_,_loc13_,_loc12_.items); } if(_loc13_.length > 0) { this.internalDispatchEvent("resolveDelta",{data:_loc13_}); } } else { var _loc3_ = undefined; var _loc15_ = this.__logChanges; this.__logChanges = dp.logChanges() && this.__logChanges; this._enableEvents = this._enableEvents - 1; var _loc14_ = dp.getKeyInfo(); this.addSort(dp.getTransactionId(),_loc14_.keyList,_loc14_.options); try { while(_loc9_.hasNext()) { _loc5_ = mx.data.components.datasetclasses.Delta(_loc9_.next()); switch(_loc5_.getOperation()) { case mx.data.components.datasetclasses.DeltaPacketConsts.Modified: _loc3_ = this._iterator.find(_loc5_.getSource()); if(_loc3_ != null) { var _loc11_ = this.__curItem; try { this.__curItem = _loc3_; var _loc4_ = undefined; var _loc8_ = _loc5_.getChangeList(); var _loc6_ = 0; while(_loc6_ < _loc8_.length) { _loc4_ = _loc8_[_loc6_]; if(_loc4_.kind == mx.data.components.datasetclasses.DeltaItem.Property) { var _loc7_ = this.__toProperties[_loc4_.name].type; this.getField(_loc4_.name).setTypedValue(new mx.data.binding.TypedValue(_loc4_.newValue,_loc7_.name,_loc7_)); } else { this[_loc4_.name].apply(_loc3_,_loc4_.argList); } _loc6_ = _loc6_ + 1; } } finally { this.__curItem = _loc11_; } } break; case mx.data.components.datasetclasses.DeltaPacketConsts.Added: _loc3_ = this.convertToRaw(_loc5_.getSource(true)); _loc3_ = this.createItem(_loc3_); this.addItem(_loc3_); break; case mx.data.components.datasetclasses.DeltaPacketConsts.Removed: _loc3_ = this.convertToRaw(_loc5_.getSource()); _loc3_ = this._iterator.find(_loc3_); if(_loc3_ != null) { this.removeItem(_loc3_); } } if(_loc3_ == null) { _global.__dataLogger.logData(null,"Couldn\'t find the following item:",_loc5_.getSource()); } } } finally { this.removeSort(dp.getTransactionId()); this._enableEvents = this._enableEvents + 1; this.__logChanges = _loc15_; } } } } function get dataProvider() { return new mx.data.components.datasetclasses.DataSetDataProvider(this); } function set dataProvider(dp) { if(dp != null) { this._loading = true; var _loc6_ = this.__logChanges; try { this.__logChanges = false; this.initCollection(); if(dp.length > 0 && this.hasInvalidSchema()) { this.defaultSchema(dp.getItemAt(0),true); } var _loc5_ = this._itemClass != null || this.__itemClassName.length > 0 || this._eventDispatcher.__q_newItem != undefined; var _loc3_ = undefined; var _loc2_ = 0; while(_loc2_ < dp.length) { _loc3_ = dp.getItemAt(_loc2_); _loc3_ = !_loc5_ ? _loc3_ : this.createItem(_loc3_); this.internalAddItem(_loc3_,_loc2_,false,true); _loc2_ = _loc2_ + 1; } this.rebuildItemIndexById(); this.initIterators(); this.internalDispatchEvent("afterLoaded"); this.internalDispatchEvent("modelChanged",{eventName:"updateAll",firstItem:0,lastItem:this.length}); } finally { this.__logChanges = _loc6_; this._loading = false; } } } function get filtered() { return this._filtered; } function set filtered(value) { if(this._filtered != value) { if(this._iterator.setFiltered(value) != 0) { this.__curItem = this.internalFirst(); this.internalDispatchEvent("modelChanged",{eventName:"filterModel"}); } this._filtered = value; } } function get filterFunc() { return this._filterFunc; } function set filterFunc(value) { if(this._filterFunc != value) { if(this._iterator.setFilterFunc(value) != 0) { this.__curItem = this.internalFirst(); this.internalDispatchEvent("modelChanged",{eventName:"filterModel"}); } this._filterFunc = value; } } function get items() { return this.__items; } function set items(itms) { var _loc6_ = this.__logChanges; this._loading = true; try { this.__logChanges = false; this.initCollection(); if(itms.length > 0 && this.hasInvalidSchema()) { this.defaultSchema(itms[0]); } var _loc5_ = this._itemClass != null || this.__itemClassName.length > 0 || this._eventDispatcher.__q_newItem != undefined; var _loc3_ = undefined; var _loc2_ = 0; while(_loc2_ < itms.length) { _loc3_ = itms[_loc2_]; _loc3_ = !_loc5_ ? _loc3_ : this.createItem(_loc3_); this.internalAddItem(_loc3_,_loc2_,false,false); _loc2_ = _loc2_ + 1; } this.rebuildItemIndexById(); this.initIterators(); this.internalDispatchEvent("afterLoaded"); this.internalDispatchEvent("modelChanged",{eventName:"updateAll",firstItem:0,lastItem:this.length}); } finally { this.__logChanges = _loc6_; this._loading = false; } } function get itemClassName() { return this.__itemClassName; } function set itemClassName(value) { if(this.__itemClassName != value && this.__items.length > 0) { throw new mx.data.components.datasetclasses.DataSetError("ItemClass can not be changed when there are already items in the collection. Error for DataSet \'" + this._name + "\'."); } this.__itemClassName = value; this._itemClass = null; } function get length() { return this.getLength(); } function get logChanges() { return this.__logChanges; } function set logChanges(value) { this.__logChanges = value; } function get properties() { return this.__toProperties; } function get readOnly() { return this.__readOnly; } function set readOnly(value) { this.__readOnly = value; } function get schema() { return this.__schemaXML; } function set schema(sch) { if(sch.firstChild.nodeName != "properties") { throw new mx.data.components.datasetclasses.DataSetError("First node of schema XML must be \'properties\'"); } this.__schema = new Object(); this.__schema.elements = new Array(); var _loc3_ = sch.firstChild.childNodes; var _loc2_ = undefined; var _loc6_ = undefined; for(var _loc4_ in _loc3_) { _loc2_ = _loc3_[_loc4_]; if(_loc2_.nodeName == "property") { this.__schema.elements.push(this.getSchemaObject(_loc2_)); } } this.__schemaXML = sch; this._invalidSchema = false; this.createProperties(); } function get selectedIndex() { return this._iterator.getItemIndex(this.__curItem); } function set selectedIndex(index) { var _loc2_ = this._iterator.getItemAt(index); if(_loc2_ != null) { this.__curItem = _loc2_; this._iterator.find(_loc2_); this.internalDispatchEvent("iteratorScrolled"); } } function addBinding(aBinding) { var _loc2_ = null; if(aBinding.source.component == this) { _loc2_ = aBinding.source; if(_loc2_.property == "dataProvider") { Object(aBinding).queueForExecute(); _loc2_.event = "NoEvent"; _loc2_ = null; } } if(aBinding.dest.component == this) { _loc2_ = aBinding.dest; } if(_loc2_ != null) { var _loc4_ = _loc2_.property; if(_loc4_ != "deltaPacket" && _loc4_ != "items") { _loc2_.event = new Array("iteratorScrolled","modelChanged"); } } this.super_addBinding(aBinding); } function addEventListener(name, handler) { this._eventDispatcher.addEventListener(name,handler); } function addSort(name, propList, options) { if(this.hasSort(name)) { throw new mx.data.components.datasetclasses.DataSetError("Sort \'" + name + "\' specified is already added. Error for dataset \'" + this._name + "\'."); } var _loc4_ = null; var _loc2_ = 0; while(_loc2_ < propList.length) { _loc4_ = this.__toProperties[propList[_loc2_]]; if(_loc4_ == null) { throw new mx.data.components.datasetclasses.DataSetError("Property \'" + propList[_loc2_] + "\' not found in schema for DataSet \'" + this._name + "\' can\'t build index."); } this.addSortInfo(this.getField(_loc4_.name),name,_loc2_); _loc2_ = _loc2_ + 1; } var _loc6_ = new mx.data.components.datasetclasses.DataSetIterator(name,this,this._iterators[mx.data.components.DataSet.DefaultIterator]); _loc6_.setFilterFunc(this._filterFunc); _loc6_.setFiltered(this._filtered); _loc6_.sortOn(propList,options); this._iterators[name] = _loc6_; this._iterator = _loc6_; this.__curItem = this._iterator.next(); this.internalDispatchEvent("modelChanged",{eventName:"sort"}); } function addItem(transferObj) { if(arguments.length > 0 && transferObj == null) { return false; } return this.addItemAt(this.length,transferObj); } function addItemAt(index, transferObj) { this.checkReadOnly(); var _loc5_ = true; if(transferObj == undefined) { transferObj = this.createItem(null); } else { var _loc7_ = transferObj[mx.data.components.DataSet.ItemId]; _loc5_ = _loc7_ == undefined || this._itemIndexById[_loc7_] == undefined; } if(_loc5_) { if(this.hasInvalidSchema()) { this.defaultSchema(transferObj); } var _loc4_ = this.internalDispatchEvent("addItem",{item:transferObj,result:true}); _loc5_ = _loc4_ == null || _loc4_.result; if(_loc5_ && index <= this.length) { _loc7_ = this.internalAddItem(transferObj,index,true,false); if(this.__logChanges) { this.logAddItem(transferObj,false); } _loc4_ = {eventName:"addItems",firstItem:index,lastItem:index}; this.resyncIterators(_loc4_); var _loc6_ = this._iterator.find({__ID__:_loc7_}); if(_loc6_ != null) { this.__curItem = _loc6_; } this.internalDispatchEvent("modelChanged",_loc4_); if(this._enableEvents < 0 && this._event != null) { this._event.data.lastItem = index; } } } return _loc5_; } function applyUpdates() { if(this._hasDelta > 0) { var _loc2_ = this.getDPTransId(); var _loc4_ = 0; if(this._dpTransIdCount == 0) { this._lastTransId = _loc2_; } else { _loc4_ = this._dpIndexByTransId[this._lastTransId].index; } this._dpIndexByTransId[_loc2_] = {index:this._deltaItems.length,prevId:this._lastTransId,items:this._optDeltaItems}; this._dpTransIdCount = this._dpTransIdCount + 1; this._deltaPacket = new mx.data.components.datasetclasses.DeltaPacketImpl(this,_loc2_,this.getKeyInfo(),false,this._srcSchema); for(var _loc3_ in this._optDeltaItems) { this._deltaPacket.addItem(this._optDeltaItems[_loc3_]); } this._lastTransId = _loc2_; this._optDeltaItems = new Array(); this._hasDelta = 0; this.internalDispatchEvent("deltaPacketChanged"); } else { this._deltaPacket = null; } } function clear() { var _loc4_ = new Array(); var _loc5_ = new Array(); var _loc2_ = undefined; var _loc6_ = undefined; var _loc8_ = this._iterator.getLength(); var _loc3_ = 0; while(_loc3_ < this.__items.length) { _loc2_ = this.__items[_loc3_]; _loc6_ = _loc2_[mx.data.components.DataSet.ItemId]; if(this._iterator.contains(_loc2_)) { if(this.__logChanges) { this.logRemoveItem(_loc2_,false); } _loc5_.push(_loc2_[mx.data.components.DataSet.ItemId]); } else { _loc4_.push(_loc2_); } _loc3_ = _loc3_ + 1; } this.__items = _loc4_; this.rebuildItemIndexById(); var _loc7_ = {eventName:"removeItems",firstItem:0,lastItem:_loc8_,removedIDs:_loc5_}; this.resyncIterators(_loc7_); this.__curItem = this.getCurrentItem(); delete _loc7_[this.items]; this.internalDispatchEvent("modelChanged",_loc7_); } function createItem(itemData) { this.checkSchema(); var _loc5_ = null; if(this._itemClass == null) { if(this.__itemClassName.length > 0) { this._itemClass = mx.utils.ClassFinder.findClass(this.__itemClassName); if(this._itemClass == null) { throw new mx.data.components.datasetclasses.DataSetError("Item class \'" + this.__itemClassName + "\' specified not found. Error for DataSet \'" + this._name + "\'."); } } else { this._itemClass = Function(Object); } } if(itemData == null) { this._propCage = new Object(); this._trapProperties = true; try { var _loc2_ = undefined; for(var _loc3_ in this.__toProperties) { _loc2_ = this._defValues[_loc3_]; if(_loc2_ != null) { this.getField(_loc3_).setTypedValue(new mx.data.binding.TypedValue(_loc2_,"String")); } } itemData = this._propCage; } finally { this._trapProperties = false; } } if(this._itemClass == Object) { _loc5_ = itemData; } else { _loc5_ = new this._itemClass(); } _loc5_.setPropertyData(itemData); this.internalDispatchEvent("newItem",{item:_loc5_}); return _loc5_; } function disableEvents() { this._enableEvents = this._enableEvents - 1; } function dispatchEvent(eventObj) { this.internalDispatchEvent(eventObj.type,eventObj); } function enableEvents() { if(this._enableEvents < 0) { this._enableEvents = this._enableEvents + 1; } if(this._enableEvents == 0) { this.internalDispatchEvent(this._event.type,this._event.data); this._event = null; } } function find(values) { var _loc2_ = this._iterator.find(this.convertToRaw(values)); if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } return _loc2_ != null; } function findFirst(values) { var _loc2_ = this._iterator.findFirst(this.convertToRaw(values)); if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } return _loc2_ != null; } function findLast(values) { var _loc2_ = this._iterator.findLast(this.convertToRaw(values)); if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } return _loc2_ != null; } function first() { var _loc2_ = this.internalFirst(); if(this.__curItem != _loc2_) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } } function getItemId(index) { var _loc2_ = ""; if(this.getLength() > 0) { _loc2_ = index != undefined ? this._iterator.getItemId(index) : this.__curItem[mx.data.components.DataSet.ItemId]; } return _loc2_; } function getIterator() { var _loc3_ = this.internalGetId(); var _loc2_ = new mx.data.components.datasetclasses.DataSetIterator(_loc3_,this,mx.data.components.datasetclasses.DataSetIterator(this._iterator)); _loc2_.first(); this._iterators[_loc3_] = _loc2_; return _loc2_; } function getLength() { return this._iterator.getLength(); } function hasNext() { return this._iterator.getLength() > 0 && (this._iterator.hasNext() || this._iterator.getCurrentItem() != null); } function hasPrevious() { return this._iterator.getLength() > 0 && (this._iterator.hasPrevious() || this._iterator.getCurrentItem() != null); } function hasSort(name) { return this._iterators[name] != undefined; } function isEmpty() { return this.length == 0; } function clearDelta(id) { return this.removeDelta(this._optDeltaItems[id]); } function changesPending() { return this._hasDelta > 0; } function locateById(id) { var _loc2_ = this._iterator.find({__ID__:id}); if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } return _loc2_ != null; } function last() { this._iterator.last(); var _loc2_ = this._iterator.previous(); this._iterator.next(); if(this.__curItem != _loc2_) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } } function loadFromSharedObj(objName, localPath) { var _loc7_ = SharedObject.getLocal(objName,localPath); if(_loc7_.data.items != undefined) { this.items = _loc7_.data.items; var _loc4_ = _loc7_.data.optDelta; this._optDeltaItems = new Array(); var _loc2_ = undefined; for(var _loc8_ in _loc4_) { _loc2_ = _loc4_[_loc8_]; this._optDeltaItems[_loc2_._id] = this.createDelta(_loc2_); } _loc4_ = _loc7_.data.delta; this._deltaItems = new Array(); var _loc8_ = 0; while(_loc8_ < _loc4_.length) { _loc2_ = _loc4_[_loc8_]; if(this._optDeltaItems[_loc2_._id] == undefined) { d = this.createDelta(_loc2_); } else { d = this._optDeltaItems[_loc2_._id]; } this._deltaItems.push(d); _loc8_ = _loc8_ + 1; } var _loc5_ = _loc7_.data.dpIndex; var _loc3_ = undefined; for(_loc8_ in _loc5_) { _loc3_ = _loc5_[_loc8_].items; for(var _loc6_ in _loc3_) { _loc3_[_loc6_] = this.findDelta(_loc6_); } } this._dpIndexByTransId = _loc5_; this._lastTransId = _loc7_.data.lastTransId; this._dpTransIdCount = _loc7_.data.transIdCount; this._hasDelta = _loc7_.data.hasDelta; } } function next() { var _loc2_ = this._iterator.next(); if(_loc2_ != null) { if(_loc2_ == this.__curItem) { _loc2_ = this._iterator.next(); } if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } } } function previous() { var _loc2_ = this._iterator.previous(); if(_loc2_ != null) { if(_loc2_ == this.__curItem) { _loc2_ = this._iterator.previous(); } if(_loc2_ != null) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } } } function propertyModified(propName, subProp, typeInfo) { if(propName == "dataProvider" || propName == "items") { this._srcSchema = typeInfo; } } function removeAll() { var _loc3_ = this.__items.length; var _loc2_ = 0; while(_loc2_ < _loc3_) { if(this.__logChanges) { this.logRemoveItem(this.__items[_loc2_],false); } _loc2_ = _loc2_ + 1; } this.__items = new Array(); this._itemIndexById = new Array(); var _loc4_ = {eventName:"removeItems",firstItem:0,lastItem:_loc3_}; this.resyncIterators(_loc4_); this.internalDispatchEvent("modelChanged",_loc4_); } function removeEventListener(name, handler) { this._eventDispatcher.removeEventListener(name,handler); } function removeItem(item) { if(arguments.length > 0 && item == null) { return false; } if(item == null) { item = this.__curItem; } var _loc4_ = this._itemIndexById[item[mx.data.components.DataSet.ItemId]]; if(_loc4_ != undefined) { return this.internalRemoveItem(item); } return false; } function removeItemAt(index) { return this.internalRemoveItem(this._iterator.getItemAt(index)); } function removeRange() { this._iterator.removeRange(); this.__curItem = this.internalFirst(); this.internalDispatchEvent("modelChanged",{eventName:"filterModel"}); } function removeSort(name) { if(this._iterators[name] != undefined) { if(name != mx.data.components.DataSet.DefaultIterator) { if(this._iterator.getId() == name) { this.setIterator(this._iterators[mx.data.components.DataSet.DefaultIterator]); } var _loc3_ = this._iterators[name].getSortInfo(); var _loc2_ = 0; while(_loc2_ < _loc3_.keyList.length) { this.removeSortInfo(this.getField(_loc3_.keyList[_loc2_]),name); _loc2_ = _loc2_ + 1; } delete this._iterators[name]; } throw new mx.data.components.datasetclasses.DataSetError("The default index can not be removed. Error on DataSet \'" + this._name + "\'."); } throw new mx.data.components.datasetclasses.DataSetError("Sort \'" + name + "\' specified does not exist. Error on DataSet \'" + this._name + "\'."); } function skip(offset) { var _loc2_ = this._iterator.skip(offset); if(_loc2_ == null) { if(offset > 0) { _loc2_ = this._iterator.previous(); } else { _loc2_ = this._iterator.next(); } } if(this.__curItem != _loc2_) { this.__curItem = _loc2_; this.internalDispatchEvent("iteratorScrolled"); } return this; } function saveToSharedObj(objName, localPath) { var _loc2_ = SharedObject.getLocal(objName,localPath); if(_loc2_ == null) { throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t access specified shared object. Error for DataSet \'" + this._name + "\'."); } _loc2_.data.items = this.__items; _loc2_.data.optDelta = this._optDeltaItems; _loc2_.data.delta = this._deltaItems; _loc2_.data.dpIndex = this._dpIndexByTransId; _loc2_.data.lastTransId = this._lastTransId; _loc2_.data.transIdCount = this._dpTransIdCount; _loc2_.data.hasDelta = this._hasDelta; if(_loc2_.flush() == false) { throw new mx.data.components.datasetclasses.DataSetError("Couldn\'t save shared object not sufficient space or rights. Error for DataSet \'" + this._name + "\'."); } } function setIterator(newIterator) { if(this._iterators[newIterator.getId()] == undefined) { throw new mx.data.components.datasetclasses.DataSetError("Can\'t assign foreign iterator \'" + newIterator.getId() + "\' to DataSet \'" + this._name + "\'."); } this._iterator = newIterator; this.__curItem = this.getCurrentItem(); this.internalDispatchEvent("modelChanged",{eventName:"filterModel"}); } function setRange(startValues, endValues) { this._iterator.setRange(this.convertToRaw(startValues),this.convertToRaw(endValues)); this.__curItem = this.internalFirst(); this.internalDispatchEvent("modelChanged",{eventName:"filterModel"}); } function useSort(sortName, options) { if(!this.hasSort(sortName)) { throw new mx.data.components.datasetclasses.DataSetError("Sort specified \'" + sortName + "\' does\'nt exist for DataSet \'" + this._name + "\'."); } var _loc2_ = this._iterators[sortName]; if(options != undefined) { _loc2_.setSortOptions(options); } _loc2_.setFiltered(this._filtered); _loc2_.setFilterFunc(this._filterFunc); this._iterator = _loc2_; this.first(); this.internalDispatchEvent("modelChanged",{eventName:"sort"}); } function addProxy() { var _loc2_ = undefined; for(var _loc3_ in this.__toProperties) { _loc2_ = String(_loc3_); this.addProperty(_loc2_,this["get_" + _loc2_],this["set_" + _loc2_]); } } function addSortInfo(fld, name, index) { if(fld.sortInfo == null) { fld.sortInfo = new Array(); } fld.sortInfo[name] = index; } function applyResolvePacket(d, resPckt, dpItems) { var _loc9_ = resPckt.length; if(d.getMessage().length > 0) { resPckt.push(Object(d)); } else { var _loc3_ = d.getChangeList(); var _loc4_ = true; var _loc2_ = 0; while(_loc2_ < _loc3_.length && _loc4_) { _loc4_ = _loc3_[_loc2_].message.length == 0; _loc2_ = _loc2_ + 1; } if(_loc2_ < _loc3_.length) { resPckt.push(Object(d)); } } var _loc6_ = _loc9_ != resPckt.length; switch(d.getOperation()) { case mx.data.components.datasetclasses.DeltaPacketConsts.Added: if(_loc6_) { this.logAddItem(d.getSource(),true,d.getId()); } else { this.updateItem(d); } break; case mx.data.components.datasetclasses.DeltaPacketConsts.Removed: if(_loc6_) { this.logRemoveItem(d.getSource(),true,d.getId()); } break; case mx.data.components.datasetclasses.DeltaPacketConsts.Modified: if(!_loc6_) { this.updateItem(d); } else { var _loc7_ = dpItems[d.getId()]; this._optDeltaItems[d.getId()] = _loc7_; this._deltaItems.push(Object(_loc7_)); this._hasDelta = this._hasDelta + 1; } } } function buildSchema() { if(this.hasInvalidSchema()) { this.__schemaXML = new XML("<properties/>"); } else { var _loc4_ = this.__schema.elements; var _loc2_ = undefined; var _loc6_ = "<properties>"; var _loc3_ = 0; while(_loc3_ < _loc4_.length) { _loc2_ = _loc4_[_loc3_]; if(this.isValidElement(_loc2_)) { if(_loc2_.type.name == "Date" && _loc2_.type.encoder == undefined) { _loc2_.type.encoder = {className:"mx.data.encoders.DateToNumber"}; } _loc6_ += "<property name=\"" + _loc2_.name + "\">" + this.getSchemaXML("type",_loc2_.type) + "</property>"; } _loc3_ = _loc3_ + 1; } _loc6_ += "</properties>"; this.__schemaXML = new XML(_loc6_); } } function createDelta(td) { var _loc10_ = undefined; var _loc1_ = undefined; var _loc3_ = undefined; _loc10_ = new mx.data.components.datasetclasses.DeltaImpl(td._id,td._source,td._op,td._message,td._accessCl); var _loc2_ = 0; while(_loc2_ < td._deltaItems.length) { _loc1_ = td._deltaItems[_loc2_]; if(_loc1_.__kind == mx.data.components.datasetclasses.DeltaItem.Property) { _loc3_ = {newValue:_loc1_.__newValue,oldValue:_loc1_.__oldValue,curValue:_loc1_.__curValue,message:_loc1_.__message}; } else { _loc3_ = {argList:_loc1_.__argList}; } new mx.data.components.datasetclasses.DeltaItem(_loc1_.__kind,_loc1_.__name,_loc3_,Object(_loc10_)); _loc2_ = _loc2_ + 1; } return _loc10_; } function checkReadOnly() { if(this.__readOnly) { throw new mx.data.components.datasetclasses.DataSetError("Can\'t modify a read only DataSet. Error for \'" + Object(this)._name + "\'."); } } function checkSchema() { if(this.hasInvalidSchema()) { throw new mx.data.components.datasetclasses.DataSetError("Schema has not been specified. Can\'t construct item. Error for DataSet \'" + this._name + "\'."); } } function createProperties() { this.removeProxy(); this._allowReslv = true; this._calcFields.__length__ = 0; this.__toProperties = new Object(); var _loc2_ = undefined; var _loc3_ = 0; while(_loc3_ < this.__schema.elements.length) { _loc2_ = this.__schema.elements[_loc3_]; if(this.isValidElement(_loc2_)) { this.__toProperties[_loc2_.name] = _loc2_; if(_loc2_.type.value != null) { this._defValues[_loc2_.name] = _loc2_.type.value; _loc2_.type.value = null; } if(this.getField(_loc2_.name).kind.isCalculated) { this._calcFields[_loc2_.name] = _loc2_; this._calcFields.__length__ = this._calcFields.__length__ + 1; } } _loc3_ = _loc3_ + 1; } this.addProxy(); this._allowReslv = this.__items.length > 0; } function convertToRaw(values) { if(values instanceof Array) { return this.convertArrayToRaw(values); } return this.convertObjectToRaw(values); } function convertArrayToRaw(values) { this._trapProperties = true; this._propCage = new Object(); try { var _loc5_ = this._iterator.getSortInfo(); var _loc4_ = undefined; var _loc6_ = undefined; var _loc3_ = undefined; var _loc2_ = 0; while(_loc2_ < _loc5_.keyList.length) { if(_loc2_ < values.length) { _loc4_ = this.getField(_loc5_.keyList[_loc2_]); _loc6_ = this.__toProperties[_loc5_.keyList[_loc2_]].type; _loc3_ = values[_loc2_]; switch(typeof _loc3_) { case "string": _loc4_.setAsString(_loc3_); break; case "boolean": _loc4_.setAsBoolean(_loc3_); break; case "number": _loc4_.setAsNumber(_loc3_); break; case "object": _loc4_.setTypedValue(new mx.data.binding.TypedValue(_loc3_,_loc6_.name,_loc6_)); } } _loc2_ = _loc2_ + 1; } } finally { this._trapProperties = false; } return this._propCage; } function convertObjectToRaw(values) { this._trapProperties = true; this._propCage = new Object(); try { var _loc6_ = this._iterator.getSortInfo(); var _loc4_ = undefined; var _loc7_ = undefined; var _loc2_ = undefined; var _loc3_ = 0; while(_loc3_ < _loc6_.keyList.length) { _loc2_ = _loc6_.keyList[_loc3_]; _loc4_ = this.getField(_loc2_); _loc7_ = this.__toProperties[_loc6_.keyList[_loc3_]].type; switch(typeof values[_loc2_]) { case "string": _loc4_.setAsString(values[_loc2_]); break; case "boolean": _loc4_.setAsBoolean(values[_loc2_]); break; case "number": _loc4_.setAsNumber(values[_loc2_]); break; case "object": _loc4_.setTypedValue(new mx.data.binding.TypedValue(values[_loc2_],_loc7_.name,_loc7_)); } _loc3_ = _loc3_ + 1; } } finally { this._trapProperties = false; } return this._propCage; } function decodeItem(item) { var _loc2_ = new Object(); var _loc4_ = this.__curItem; this.__curItem = item; try { for(var _loc3_ in this.__toProperties) { _loc2_[_loc3_] = this.getField(_loc3_).getTypedValue().value; } } finally { this.__curItem = _loc4_; } return _loc2_; } function defaultSchema(obj) { var _loc2_ = undefined; var _loc3_ = undefined; var _loc4_ = ""; for(var _loc6_ in obj) { _loc2_ = typeof obj[_loc6_]; if(_loc2_ != "function") { _loc2_ = String(_loc2_.charAt(0)).toUpperCase() + _loc2_.substring(1,_loc2_.length); if(_loc2_ == "Boolean") { _loc3_ = "Bool"; } else { _loc3_ = _loc2_.substring(0,3); } _loc4_ = "<property name=\"" + _loc6_ + "\"><type name=\"" + _loc2_ + "\" original=\"false\"><validation className=\"mx.data.types." + _loc3_ + "\"/></type></property>" + _loc4_; } } this.schema = new XML("<properties>" + _loc4_ + "</properties>"); } function decodeValue(fieldName, value) { this._fldValObj.__schema = this.__schema; this._fldValObj[fieldName] = value; return this._fldValObj.getField(fieldName).getTypedValue().value; } function encodeValue(fieldName, value) { var _loc2_ = this.__toProperties[fieldName].type; this._fldValObj.__schema = this.__schema; this._fldValObj.getField(fieldName).setTypedValue(new mx.data.binding.TypedValue(value,_loc2_.name,_loc2_)); return this._fldValObj[fieldName]; } function findDelta(id) { var _loc2_ = 0; while(_loc2_ < this._deltaItems.length) { if(this._deltaItems[_loc2_]._id == id) { return this._deltaItems[_loc2_]; } _loc2_ = _loc2_ + 1; } return null; } function internalDispatchEvent(type, params) { var _loc3_ = null; if(this._enableEvents >= 0) { _loc3_ = {type:type,target:this}; if(params != undefined) { for(var _loc4_ in params) { _loc3_[_loc4_] = params[_loc4_]; } } this._eventDispatcher.dispatchEvent(_loc3_); } else if(this._event != null && this._event.type == "modelChanged") { if(type == "modelChanged") { if(this._event.data.eventName != "sort" && this._event.data.eventName != "filter") { this._event.data = params; } } } else { this._event = {data:params,type:type}; } return _loc3_; } function getDataProviderItem(item, desiredTypes) { var _loc5_ = new Object(); var _loc4_ = undefined; var _loc8_ = this.__curItem; var _loc3_ = undefined; var _loc2_ = undefined; try { this.__curItem = item; for(var _loc7_ in this.__toProperties) { _loc3_ = desiredTypes[_loc7_]; if(_loc3_ == null) { _loc3_ = "String"; } _loc4_ = this.getField(_loc7_); _loc2_ = _loc4_.getTypedValue(_loc3_); if(_loc2_ == null) { _loc2_ = _loc4_.getTypedValue(); } _loc5_[_loc7_] = _loc2_.value; } } finally { this.__curItem = _loc8_; } return _loc5_; } function getEditingData(fieldName, item, desiredTypes) { var _loc4_ = undefined; var _loc5_ = this.__curItem; var _loc2_ = undefined; try { this.__curItem = item; _loc2_ = desiredTypes[fieldName]; if(_loc2_ == null) { _loc2_ = "String"; } var _loc3_ = this.getField(fieldName); val = _loc3_.getTypedValue(_loc2_); if(val == null) { val = _loc3_.getTypedValue(); } _loc4_ = val.value; } finally { this.__curItem = _loc5_; } return _loc4_; } function getDisplayValue(propName, index) { var _loc3_ = this.__curItem; var _loc2_ = ""; try { this.__curItem = this.__items[index]; _loc2_ = this.getField(propName).getAsString(); } finally { this.__curItem = _loc3_; } return _loc2_; } function getCurrentItem() { var _loc2_ = this._iterator.getCurrentItem(); if(_loc2_ == null) { if(this._iterator.hasNext()) { _loc2_ = this._iterator.next(); this._iterator.previous(); } else { _loc2_ = this._iterator.previous(); this._iterator.next(); } } return _loc2_; } function getInternalIndex(index) { var _loc2_ = this._iterator.getItemAt(index); if(_loc2_ == null) { return -1; } return this._itemIndexById[_loc2_[mx.data.components.DataSet.ItemId]]; } function getKeyInfo() { var _loc3_ = undefined; var _loc2_ = undefined; for(var _loc5_ in this._iterators) { _loc3_ = this._iterators[_loc5_]; _loc2_ = _loc3_.getSortInfo(); if(_loc5_ != mx.data.components.DataSet.DefaultIterator && (_loc2_.options & mx.data.components.datasetclasses.DataSetIterator.Unique) == mx.data.components.datasetclasses.DataSetIterator.Unique) { return {options:_loc2_.options,keyList:_loc2_.keyList.slice(0)}; } } var _loc4_ = new Array(); for(_loc5_ in this.__toProperties) { _loc4_.push(_loc5_); } return {options:mx.data.components.datasetclasses.DataSetIterator.Unique,keyList:_loc4_}; } function getModDeltaInfo(id) { var _loc3_ = null; var _loc5_ = null; var _loc6_ = this._optDeltaItems[id]; if(_loc6_ == undefined) { _loc3_ = this.__curItem; if(_loc3_.clone == undefined) { var _loc8_ = _loc3_.getPropertyData(); if(_loc8_ != null) { _loc5_ = this.createItem(_loc8_); } else { _loc5_ = new Object(); } } else { _loc5_ = _loc3_.clone(); } var _loc2_ = undefined; var _loc4_ = undefined; for(var _loc7_ in _loc3_) { _loc2_ = _loc3_[_loc7_]; if(typeof _loc2_ != "function") { _loc4_ = this.__toProperties[_loc7_]; _loc5_[_loc7_] = _loc4_ != undefined ? this.getField(_loc7_).getTypedValue().value : _loc2_; } } _loc6_ = new mx.data.components.datasetclasses.DeltaImpl(id,_loc5_,mx.data.components.datasetclasses.DeltaPacketConsts.Modified); this._optDeltaItems[id] = _loc6_; this._hasDelta = this._hasDelta + 1; this._deltaItems.push(_loc6_); } return _loc6_; } function getPropertyValue(name) { return this.__curItem[name]; } function getResolverFieldList() { var _loc2_ = new Object(); for(var _loc3_ in this.__toProperties) { if(this._calcFields[_loc3_] == null && this.__toProperties[_loc3_].type.path == null) { _loc2_[_loc3_] = this.__toProperties[_loc3_]; } } return _loc2_; } function getDPTransId() { return this.internalGetId() + ":" + new Date().toString(); } function getSchemaObject(xmlInfo) { var _loc3_ = new Object(); var _loc5_ = undefined; for(var _loc2_ in xmlInfo.attributes) { _loc5_ = xmlInfo.attributes[_loc2_]; if(_loc2_ == "original") { _loc3_[_loc2_] = _loc5_ != "false" ? true : false; } else { _loc3_[_loc2_] = _loc5_; } } var _loc4_ = xmlInfo.childNodes; var _loc7_ = undefined; var _loc2_ = 0; while(_loc2_ < _loc4_.length) { _loc3_[_loc4_[_loc2_].nodeName] = this.getSchemaObject(_loc4_[_loc2_]); _loc2_ = _loc2_ + 1; } return _loc3_; } function getSchemaXML(nodeName, info) { var _loc5_ = ""; var _loc2_ = undefined; for(var _loc6_ in info) { _loc2_ = info[_loc6_]; if(typeof _loc2_ != "object" && _loc6_ != "cls") { _loc5_ += " " + _loc6_ + "=\"" + _loc2_ + "\""; } } var _loc4_ = "<" + nodeName + _loc5_ + ">"; for(_loc6_ in info) { _loc2_ = info[_loc6_]; if(typeof _loc2_ == "object") { _loc4_ += this.getSchemaXML(_loc6_,_loc2_); } } _loc4_ += "</" + nodeName + ">"; return _loc4_; } function hasInvalidSchema() { if(this._invalidSchema == undefined) { this._invalidSchema = true; if(this.__schema.elements != null) { var _loc2_ = this.__schema.elements; for(var _loc3_ in _loc2_) { if(_loc2_[_loc3_].type.original == false) { this._invalidSchema = false; return this._invalidSchema; } } } } return this._invalidSchema; } function initCollection() { this.__items = new Array(); this._itemIndexById = new Array(); this.internalClearDeltaPacket(); } function internalAddItem(item, index, rebuildIndx, pipeData) { var _loc7_ = undefined; if(item[mx.data.components.DataSet.ItemId] == null) { _loc7_ = this.internalGetId(); item[mx.data.components.DataSet.ItemId] = _loc7_; } else { _loc7_ = item[mx.data.components.DataSet.ItemId]; } if(index >= this.__items.length) { this.__items.push(item); } else { this.__items.splice(index,0,item); } this._enableEvents = this._enableEvents - 1; var _loc8_ = this._event; this._trapProperties = true; try { this._propCage = item; var _loc3_ = undefined; for(var _loc6_ in this.__toProperties) { _loc3_ = this.__toProperties[_loc6_]; if(rebuildIndx && (item[_loc6_] == null && this._calcFields[_loc6_] == null)) { this.getField(_loc6_).setAsString(this.__toProperties[_loc6_].type.value); } else if(item[_loc6_] != null && pipeData) { this.getField(_loc6_).setTypedValue(new mx.data.binding.TypedValue(item[_loc6_],_loc3_.type.name,_loc3_.type)); } } } finally { this._enableEvents = this._enableEvents + 1; this._event = _loc8_; this._trapProperties = false; } if(this._calcFields.__length__ > 0) { this.__curItem = item; this._loading = true; try { this.internalDispatchEvent("calcFields"); } finally { this._loading = false; } } this._allowReslv = true; if(rebuildIndx) { this.rebuildItemIndexById(); } return _loc7_; } function internalClearDeltaPacket(transId) { if(transId == undefined || transId.length == 0) { this._optDeltaItems = new Array(); this._deltaItems = new Array(); this._dpIndexByTransId = new Array(); this._lastTransId = ""; this._dpTransIdCount = 0; this._hasDelta = 0; } else { var _loc2_ = this._dpIndexByTransId[transId]; if(_loc2_ != undefined) { var _loc6_ = this._dpIndexByTransId[_loc2_.prevId].index; _loc6_ = _loc6_ != _loc2_.index ? _loc6_ : 0; var _loc5_ = _loc2_.index - _loc6_; this._deltaItems.splice(_loc6_,_loc5_); var _loc3_ = this._lastTransId; while(_loc3_ != transId) { _loc2_ = this._dpIndexByTransId[_loc3_]; _loc3_ = _loc2_.prevId; _loc2_.index -= _loc5_; } delete this._dpIndexByTransId[transId]; this._dpTransIdCount = this._dpTransIdCount - 1; if(this._dpTransIdCount == 0) { this._lastTransId = ""; } } } } function internalGetId() { return "IID" + String(Math.round(Math.random() * 100000000000)); } function internalFirst() { this._iterator.first(); var _loc2_ = this._iterator.next(); this._iterator.previous(); return _loc2_; } function internalRemoveItem(item) { this.checkReadOnly(); var _loc2_ = this._itemIndexById[item[mx.data.components.DataSet.ItemId]]; var _loc3_ = _loc2_ != undefined; var _loc4_ = this.internalDispatchEvent("removeItem",{result:true,item:item}); _loc3_ = _loc4_ == null || _loc4_.result; if(_loc3_) { this.__items.splice(_loc2_,1); this.rebuildItemIndexById(); if(this.__logChanges) { this.logRemoveItem(item,false); } _loc4_ = {eventName:"removeItems",firstItem:_loc2_,lastItem:_loc2_,removedIDs:new Array(item[mx.data.components.DataSet.ItemId])}; this.resyncIterators(_loc4_); this._allowReslv = this.__items.length > 0; this.__curItem = this.getCurrentItem(); this.internalDispatchEvent("modelChanged",_loc4_); if(this._enableEvents < 0 && this._event != null) { this._event.data.lastItem = _loc2_; } } return _loc3_; } function initIterators() { var _loc2_ = null; if(this._iterators != undefined) { _loc2_ = this._iterators[mx.data.components.DataSet.DefaultIterator].getFilterFunc(); } this._iterators = new Array(); this._iterator = new mx.data.components.datasetclasses.DataSetIterator(mx.data.components.DataSet.DefaultIterator,this); this._iterator.setFilterFunc(_loc2_); this._iterators[mx.data.components.DataSet.DefaultIterator] = this._iterator; this._iterator.first(); this.__curItem = this._iterator.next(); } function isValidElement(el) { return el.type.original == false; } function logAddItem(item, piped, id) { if(id == undefined) { id = item[mx.data.components.DataSet.ItemId]; } var _loc2_ = new mx.data.components.datasetclasses.DeltaImpl(id,!piped ? this.decodeItem(item) : item,mx.data.components.datasetclasses.DeltaPacketConsts.Added); this._optDeltaItems[id] = _loc2_; this._deltaItems.push(Object(_loc2_)); this._hasDelta = this._hasDelta + 1; } function logRemoveItem(item, piped, id) { if(id == undefined) { id = item[mx.data.components.DataSet.ItemId]; } var _loc3_ = this._optDeltaItems[id]; item = !piped ? this.decodeItem(item) : item; var _loc6_ = _loc3_ != undefined ? _loc3_.getSource() : item; var _loc5_ = new mx.data.components.datasetclasses.DeltaImpl(id,_loc6_,mx.data.components.datasetclasses.DeltaPacketConsts.Removed); this._deltaItems.push(Object(_loc5_)); if(_loc3_ != undefined && _loc3_.getOperation() == mx.data.components.datasetclasses.DeltaPacketConsts.Added) { delete this._optDeltaItems[id]; this._hasDelta = this._hasDelta - 1; } else { delete this._optDeltaItems[id]; this._optDeltaItems[id] = _loc5_; this._hasDelta = this._hasDelta + 1; } } function rebuildItemIndexById() { this._itemIndexById = new Array(); var _loc3_ = undefined; var _loc2_ = 0; while(_loc2_ < this.__items.length) { _loc3_ = this.__items[_loc2_]; this._itemIndexById[_loc3_[mx.data.components.DataSet.ItemId]] = _loc2_; _loc2_ = _loc2_ + 1; } } function removeProxy() { var _loc2_ = undefined; for(var _loc3_ in this.__toProperties) { _loc2_ = this.__toProperties[_loc3_]; delete this[_loc2_]; delete this["get_" + _loc2_]; delete this["set_" + _loc2_]; } } function resyncIterators(info) { for(var _loc3_ in this._iterators) { this._iterators[_loc3_].modelChanged(info); } } function setPropertyValue(name, value) { if(this._trapProperties) { this._propCage[name] = value; } else { if(this._calcFields[name] != undefined) { this.__curItem[name] = value; } else { this.checkReadOnly(); var _loc7_ = this.__curItem[name]; if(_loc7_ != value) { if(this.__logChanges) { var _loc6_ = this.getModDeltaInfo(this.__curItem[mx.data.components.DataSet.ItemId]); this.__curItem[name] = value; if(_loc6_.getOperation() == mx.data.components.datasetclasses.DeltaPacketConsts.Modified) { var _loc9_ = _loc6_.getItemByName(name); if(_loc9_ != null) { _loc7_ = this.encodeValue(name,_loc9_.oldValue); } if(_loc7_ != value) { new mx.data.components.datasetclasses.DeltaItem(mx.data.components.datasetclasses.DeltaItem.Property,name,{oldValue:this.decodeValue(name,_loc7_),newValue:this.decodeValue(name,value),message:""},Object(_loc6_)); } else if(_loc6_.getChangeList().length == 1) { this.removeDelta(_loc6_); } } else { _loc6_.getSource()[name] = this.decodeValue(name,value); } } this.__curItem[name] = value; } if(this._calcFields.__length__ > 0) { this.internalDispatchEvent("calcFields"); } } if(!this._loading) { var _loc10_ = this._itemIndexById[this.__curItem[mx.data.components.DataSet.ItemId]]; var _loc4_ = {eventName:"updateField",fieldName:name,firstItem:_loc10_,lastItem:_loc10_}; var _loc2_ = false; for(var _loc8_ in this._iterators) { _loc2_ = this._iterators[_loc8_].modelChanged(_loc4_) || _loc2_; } if(_loc2_) { this.internalDispatchEvent("modelChanged",{eventName:"sort"}); } else { this.internalDispatchEvent("modelChanged",_loc4_); } } } } function removeSortInfo(fld, name) { if(fld.sortInfo != null) { delete fld.sortInfo[name]; } } function removeDelta(d) { var _loc3_ = false; var _loc2_ = 0; while(!_loc3_ && _loc2_ < this._deltaItems.length) { _loc3_ = this._deltaItems[_loc2_] == d; _loc2_ = _loc2_ + 1; } if(_loc3_) { this._deltaItems.splice(_loc2_ = _loc2_ - 1,1); delete this._optDeltaItems[d.getId()]; this._hasDelta = this._hasDelta - 1; } return _loc3_; } function __resolve(methodName) { var _loc3_ = null; if(this._allowReslv) { var propName = methodName.substring(4); if(methodName.substr(0,4) == "get_") { _loc3_ = function() { return this.getPropertyValue(propName); }; } else if(methodName.substr(0,4) == "set_") { _loc3_ = function() { this.setPropertyValue(propName,arguments[0]); }; } else { arguments.shift(); _loc3_ = function() { this.__curItem[methodName].apply(this.__curItem,arguments); var _loc3_ = this.__curItem[mx.data.components.DataSet.ItemId]; if(this.__logChanges) { var _loc5_ = this.getModDeltaInfo(_loc3_); new mx.data.components.datasetclasses.DeltaItem(mx.data.components.datasetclasses.DeltaItem.Method,methodName,{argList:arguments,message:""},Object(_loc5_)); } var _loc4_ = this._itemIndexById[_loc3_]; this.internalDispatchEvent("modelChanged",{eventName:"updateItems",firstItem:_loc4_,lastItem:_loc4_}); }; } } return _loc3_; } function updateItem(d) { var _loc8_ = d.getId(); var _loc10_ = undefined; var _loc6_ = null; var _loc12_ = this.__logChanges; this.__logChanges = false; try { if(_loc8_ == null) { _loc10_ = d.getSource(); } else { _loc10_ = {__ID__:_loc8_}; } _loc6_ = this._iterator.find(_loc10_); if(_loc6_ != null) { var _loc9_ = this._itemIndexById[_loc6_[mx.data.components.DataSet.ItemId]]; var _loc5_ = d.getChangeList(); var _loc3_ = undefined; var _loc11_ = this.__curItem; try { this.__curItem = _loc6_; var _loc4_ = 0; while(_loc4_ < _loc5_.length) { _loc3_ = mx.data.components.datasetclasses.DeltaItem(_loc5_[_loc4_]); this.getField(_loc3_.name).setTypedValue(new mx.data.binding.TypedValue(_loc3_.curValue,this.__toProperties[_loc3_.name].type.name,this.__toProperties[_loc3_.name].type)); _loc4_ = _loc4_ + 1; } } finally { this.__curItem = _loc11_; } this.internalDispatchEvent("modelChanged",{eventName:"updateItems",firstIndex:_loc9_,lastIndex:_loc9_}); } else { _global.__dataLogger.logData(null,"Couldn\'t find the following item:",d.getSource()); } } finally { this.__logChanges = _loc12_; } } }